package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;

/**
 * Created by Administrater on 2015/12/7.
 */
public class StartLiveTask extends CouponHttpBaseTask {
    private String mVid;
    private String mLiveCover;
    private String mliveTitle;
    private int isOpen;
    private int liveType;
    private String fee;
    private String pwd;
    private int isLive;
    private String mliveTime;
    private String mliveCate;
    private String mliveContent;
    private String mZhiBoId;
    private String mApple;

    public StartLiveTask(String vid, String zhiboid,String liveCover, String liveTitle,
                         int open, int type, String price, String psw, int xubo, String liveTime, String liveCate,String liveContent,String apple) {
        super();
        mVid = vid;
        mZhiBoId = zhiboid;
        mLiveCover = liveCover;
        mliveTitle = liveTitle;
        isOpen = open;
        liveType = type;
        fee = price;
        pwd = psw;
        isLive = xubo;
        mliveTime = liveTime;
        mliveCate = liveCate;
        mliveContent = liveContent;
        mApple = apple;
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
        notifyTaskCompleted(TaskResultCode.SUCCESS, null);
    }

    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase == TASK_PHASE_INIT) {
            CouponHttpRequest request = new CouponHttpRequest();
            JSONObject json = new JSONObject();
            json.put("vid", mVid);
            json.put("id",mZhiBoId);
            json.put("liveCover", mLiveCover);
            json.put("liveTitle", mliveTitle);
            json.put("isOpen", isOpen);
            json.put("liveType", liveType);
            json.put("fee", fee);
            json.put("pwd", pwd);
            json.put("isLive", isLive);
            json.put("liveTime",mliveTime);
            json.put("liveCate",mliveCate);
            json.put("liveContent",mliveContent);
            json.put("apple",mApple);
            request.setData(json.toString());
            request.setApiNo(ApiNo.STARTLIVE);
            addRequest(request);
        }
    }

}
